fix(autocomplete): omit hidden flags from suggestions - #122
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Castiron custom code✅ No new custom-code files detected. 5 mixed files remain; 0 existing customizations changed. Compared 5 existing customizations unchanged
A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 34893689033 --repo openai/openai-cli \
--name castiron-custom-code-34893689033-1 --dir /tmp/castiron-custom-code-34893689033-1
git apply --stat /tmp/castiron-custom-code-34893689033-1/custom-code.patch
cat /tmp/castiron-custom-code-34893689033-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 642d5119227b54a84de0b0aa38d99d148a51148c ca2516e7baf3dcd284f9b4e2f7212daa9abd8616
python3 scripts/castiron/custom_code_report.py report \
--base 642d5119227b54a84de0b0aa38d99d148a51148c \
--head ca2516e7baf3dcd284f9b4e2f7212daa9abd8616 --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-ca2516e7baf3
cat /tmp/castiron-custom-code-ca2516e7baf3/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
saioai
left a comment
There was a problem hiding this comment.
hidden flags and their aliases no longer show up in autocomplete, but the flags still work if typed directly. the new test caught the issue on main and passed 100 runs on this branch. race tests, internal tests, build, and vet passed locally too. the full suite passed with one FIFO test excluded because it also fails on main. looks good
|
Thanks for the careful review and validation. Glad the hidden-flag behavior and aliases are now covered and this is merged. |
Summary
Keep hidden/internal CLI flags out of shell-completion suggestions.
Problem
The autocomplete code already respects
cli.VisibleFlagwhen resolving an entered flag throughfindFlag, but the flag-name completion path loops over every flag incmd.Flagswithout applying the same visibility check.That means flags deliberately marked hidden can still be surfaced by Bash/Zsh/Fish/PowerShell completion when the user starts typing
-or--.This is separate from the existing hidden-command work: command suggestions already have their own
child.Hiddenhandling, while this PR fixes flag visibility.Fix
Apply the same
cli.VisibleFlag/IsVisible()guard used byfindFlagbefore generating flag-name completions.Visible flags and aliases keep their existing completion behavior. Flags that do not implement
cli.VisibleFlagare also unchanged.Regression coverage
Added a focused synthetic-command regression with one visible and one hidden flag, each with a short alias. The test verifies both long and short visible names remain suggested while both hidden names are omitted.
Validation
The branch is based directly on current upstream
main(a7719136b8ed401b0c51a05553a5e4f720150307) and contains one DCO-signed commit. The production change is 3 lines in handwritteninternal/autocomplete/autocomplete.go, plus focused regression coverage. Full repository test execution is left to CI.Risk
Low. The change only removes completion candidates for flags the CLI already marks as not visible; parsing and command execution are unchanged.